package file2;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;

public class Demo1 {
    public static void main(String[] args) throws IOException {
        //描述并创建文件对象file
        File file=new File("test.txt");
        file.createNewFile();
        //使用创建好的文件对象来创建输出流对象
        OutputStream outputStream=new FileOutputStream(file);
        outputStream.write('h');
        outputStream.write('e');
        outputStream.write('l');
        outputStream.write('l');
        outputStream.write('o');
        //删除流对象
        outputStream.close();
    }
}
